package laboratorioV.grupo21.tp4.IO;

import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;



import laboratorioV.grupo21.tp4.deposito.Deposito;

public class FileObj {
	public synchronized Deposito buscarDepositoFile() throws Exception{
		ObjectInputStream in = null;
		try {
			File fileProductos = new File("deposito.bin");
			if( fileProductos.exists() == false)
				return null;
				
			Deposito depositoAux = null;
			FileInputStream file = new FileInputStream("deposito.bin");		
			in = new ObjectInputStream(file);
			depositoAux = (Deposito) in.readObject();
			return depositoAux;
		} catch (Exception e) {
			throw e;
		}
		finally{
			if(in != null)
				in.close();
		}
	}
}
